<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewdatart" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
	<script src="./js/jqery-3.5.1.min.js"></script>

    <link rel="stylesheet" href="./css/shopingcar.css">

</head>
<body>
    <div id="top">
        <div id="topleft">
            <!--<img src="img/doge.png" alt="logo">-->
        </div>
        <div id="topmid">
            <input type="text" id="searchinput" value="搜索" style="border:none;">
        </div>
        <div id="topright">
            <div style="flex:1"></div>
            <a class="topicon tooltip" href=""  onclick=jumptoindex()>
                <svg t="1606107961268" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2807" width="200" height="200"><path d="M941.5 505.8L559.2 159.4l-25.6-23.2c-12.2-10.9-31.8-10.9-43.9 0l-408 369.6c-12.2 11-18.7 25.7-18.6 41.3 0.4 31.6 29.4 56.8 64.2 56.8h42.1V896H854V603.9h42.9c16.9 0 32.9-6 44.8-16.9 12-10.9 18.5-25.3 18.5-40.6-0.1-15.3-6.7-29.7-18.7-40.6zM567 831.4H456.1v-183H567v183z m215.6-292.1v292.1H630.3V626.9c0-19.8-17.7-35.9-39.6-35.9H432.4c-21.9 0-39.6 16.1-39.6 35.9v204.5H240.5V539.3h-95l366.1-331.6 22.9 20.7 343.2 310.9h-95.1z m0 0" p-id="2808" fill="#ffffff"></path></svg>
                <span class="tooltiptext">主页</span>
            </a>
            <a class="topicon tooltip" href="" onclick=jumptomymills()>
                <svg t="1605864452023" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1200" width="200" height="200"><path d="M845 178.5H177.6c-22.4 0-40.5 17.6-40.5 39.4V454.2c0 4.6 1 8.9 2.5 12.9 6.8 34.8 27.8 64.3 56.7 83.2v278c0 21.7 17.6 39.4 39.4 39.4h551.4c21.7 0 39.4-17.6 39.4-39.4v-278c28.8-18.9 49.9-48.4 56.7-83.2 1.5-4.1 2.4-8.4 2.4-12.9V217.8c-0.1-21.8-18.2-39.3-40.6-39.3z m-77.7 630.1h-512V571.1c4.4 0.4 8.8 1.2 13.3 1.2 54.2 0 100.8-32.5 120.9-78.8h0.9c20.1 46.3 66.6 78.8 120.9 78.8 54.2 0 100.8-32.5 120.9-78.8h0.9c20.1 46.3 66.6 78.8 120.9 78.8 4.5 0 8.9-0.7 13.3-1.2v237.5z m59.1-421.7V450l-0.5 1.3-0.9 4.5c-6.4 33.2-36.3 57.4-71.1 57.4-29.1 0-55.3-17-66.7-43.2l-15.4-35.6h-77.6L578 470c-11.4 26.2-37.5 43.2-66.7 43.2-29.2 0-55.4-17-66.7-43.2l-15.4-35.6h-77.6L335.4 470c-11.4 26.2-37.6 43.2-66.7 43.2-34.7 0-64.6-24.1-71.1-57.4l-0.8-4.5-0.5-1.3V237.5h630.2v149.4z" fill="#ffffff" p-id="1201"></path></svg>
                <span class="tooltiptext">商家端</span>
            </a>
            <a href="#" class="topicon tooltip" onclick=jumptologinorhome()>
                <svg t="1605611214598" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="15371" width="200" height="200"><path d="M923.3 754.7c-22.4-50-54.4-94.8-95.2-133.2-40.6-38.3-87.8-68.3-140.4-89.3-11-4.4-22.1-8.3-33.4-11.8 12.7-8.7 24.6-18.6 35.7-29.7 47.1-47.1 73-109.6 73-176.2 0-66.5-25.9-129.1-73-176.2-47.1-47.1-109.6-73-176.2-73s-129.1 25.9-176.2 73c-47.1 47.1-73 109.6-73 176.2 0 66.5 25.9 129.1 73 176.2 10.8 10.8 22.3 20.4 34.6 28.9-12.1 3.7-24.1 7.9-36 12.6-52.6 21-99.8 51-140.4 89.3-40.8 38.4-72.8 83.2-95.2 133.2-23.3 51.9-35.1 107-35.1 163.9 0 22.1 17.9 40 40 40s40-17.9 40-40c0-186.9 162.4-339 361.9-339h8.9c199.6 0 361.9 152.1 361.9 339 0 22.1 17.9 40 40 40s40-17.9 40-40c0.2-56.8-11.6-112-34.9-163.9zM513.9 145.4c93.3 0 169.1 75.9 169.1 169.1s-75.9 169.1-169.1 169.1-169.1-75.9-169.1-169.1 75.8-169.1 169.1-169.1z" p-id="15372" fill="#ffffff"></path></svg>
                <span class="tooltiptext">我的账户</span>
            </a>
        </div>
    </div>
    <div style="height: 50px;"></div>
    <table>
        <tr id="up">
            <th style="flex: 4;">
                <form>
                    <input type="checkbox" id="selectingall" name="vehicle" value="Bike" onclick="selectall()">全选<br>
                </form>
            </th>
            <th style="flex: 15;">商品</th>
            <th>价格</th>
            <th>数量</th>
            <th>小计</th>
            <th onclick="clearall()" style="color: rgb(202, 0, 0);">清空</th>
        </tr>

        <tr class="goods" id="1">
            <td class="select">
                
                    <input type="checkbox" name="vehicle" value="Bike"><br>
                
            </td>
            <td class="what">
                <a href="" >
                    <img src="https://bkimg.cdn.bcebos.com/pic/3c6d55fbb2fb4316b81c19dd2ca4462309f7d312?x-bce-process=image/watermark,image_d2F0ZXIvYmFpa2U5Mg==,g_7,xp_5,yp_5" width="70" height="70" ><i>A型</i>
                </a>
                doge
            </td>
            <td class="price">￥555</td>
            <td class="number"><input  value="1" type="number" min="1" oninput="this.value=this.value.replace(/\D/g);">
            </td>
            <td class="sum">￥1110</td>
            <td class="operate" id="">删除</td>
        </tr>
        <tr class="goods" id="2">
            <td class="select">
                
                    <input type="checkbox" name="vehicle" value="Bike"><br>
                
            </td>
            <td class="what">
                <a href="" >
                    <img src="https://bkimg.cdn.bcebos.com/pic/3c6d55fbb2fb4316b81c19dd2ca4462309f7d312?x-bce-process=image/watermark,image_d2F0ZXIvYmFpa2U5Mg==,g_7,xp_5,yp_5" width="70" height="70" ><i>A型</i>
                </a>
                doge
            </td>
            <td class="price">￥555</td>
            <td class="number"><input  value="1" type="number" min="1" oninput="this.value=this.value.replace(/\D/g);">
            </td>
            <td class="sum">￥1110</td>
            <td class="operate" id="">删除</td>
        </tr>









    </table>
    <div id="down">
        <div id="where">
            <div>送至</div>
            <input type="text" value="地球" id="towhere">
        </div>

        <div id="bottom-right">
            <div id="pay">
                <div id="sum1" style="display: inline-block;">共计：￥</div>
                <div id="sum2">555555</div>
            </div>
            <div id="submit" style="width: 50px;">结算</div>
            <div></div>
        </div>
    </div>
    <!-- <script>
        setTimeout(function(){
            window.location.reload();
        },1000)
    </script> -->
    <script src="./js/jump.js"></script>

    <script>
    function cart(){
            var token = document.cookie.split(";")[0]; 
            $.ajax({
                url:"http://localhost/user/showmyshoppingcar",
                ret: "0",
                type:"POST",
                dataType: "json",
                data: JSON.stringify({
                    token: token,
                }),
                success: function(data){
                    if (data.ret==1){
                        window.location.href="http://localhost/login.html"
                    }
                    else{
                        console.log(data)
                        $("table").append(data.data)
                        $("#sum2").text(data.bigsum)
                        $(".operate").click(function(){
                            $.ajax({
                                url:"http://localhost/user/deletefrommyshoppingcar",
                                ret: "0",
                                type:"POST",
                                dataType: "json",
                                data: JSON.stringify({
                                    token: token,
                                    styleid:$(this.parentNode).attr('id'),
                                }),
                                success: function(data){
                                    alert(data.msg)
                                    window.location.href="http://localhost/shoppingcar.html"
                                }
                            })
                        })

                        $("body").append("<script src=\"\.\/js\/selectall\.js\"><\/script>")

                    }
                }
            
            })
    }
        
        cart()
    </script>
 
   
    <script src="./js/background.js"></script>
    <script>
        
    </script>


</body>
</html>